package com.paw.core.config;

import com.paw.core.util.RedisUtilService;
import com.paw.core.util.StringRedisUtilService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * @author Rubble
 * @date 2021/8/27
 **/
@Configuration
@ConditionalOnClass(RedisOperations.class)
public class RedisUtilConfiguration {

  @Bean
  public RedisUtilService redisUtilService(RedisTemplate redisTemplate){
    return new RedisUtilService(redisTemplate);
  }

  @Bean
  public StringRedisUtilService stringRedisUtilService(StringRedisTemplate redisTemplate){
    return new StringRedisUtilService(redisTemplate);
  }

}
